var express = require('express');
var router = express.Router();


var {
    westdrugModel,chiadrugModel,
    recordModel,
    prescriptionModel,
    westPSModel, chiaPSModel,
    inspectModel,
    ISlistModel, MachineModel, ISselectModel,
    testModel,
    testListModel, testMachineModel, TTselectModel,
    patients,
    Moneys
} = require('../model/model')

router.post('/drugadd',async(req,res)=>{//添加中西药品
    console.log(req.body)
    // await westdrugModel.insertMany(req.body)
    // await chiadrugModel.insertMany(req.body)
    res.send({code:200,msg:'drugadd y'})
})
router.post('/inspectadd',async(req,res)=>{//添加检察检验
    // console.log(req.body)
    // await ISListModel.insertMany(req.body)
    // await testListModel.insertMany(req.body) 
    res.send({code:200,msg:'inspectadd y'})
})
router.post('/machinesadd',async(req,res)=>{//添加检察检验
    // console.log(req.body)
    // await MachineModel.insertMany(req.body)
    // res.send({code:200,msg:'machinesadd y'})
})


router.post('/getmachines',async(req,res)=>{//获取检察检验项目
    console.log(req.body)
    let lis = await MachineModel.find({'tid':req.body.id})
    res.send({lis:lis})
})



// router.get('/index',async(req,res)=>{
//     let lis = await chiadrugModel.find()
//     res.send(lis)
// })
router.get('/sindex',async(req,res)=>{//检查列表
    let lis = await ISlistModel.find()
    res.send({lis:lis})
})
router.get('/tindex',async(req,res)=>{//检验列表
    let lis = await testListModel.find()
    res.send({lis:lis})
})
router.get('/windex',async(req,res)=>{//西药列表
    let lis = await westdrugModel.find()
    res.send({lis:lis})
})
router.get('/cindex',async(req,res)=>{//中药列表
    let lis = await chiadrugModel.find()
    res.send({lis:lis})
})
router.get('/mindex',async(req,res)=>{//挂号列表
    let lis = await Moneys.find()
    res.send({lis:lis})
})






    





module.exports = router;